﻿using Admin.Models;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace Admin.DAL
{
    public class FloorAdminDAL:ConnectionDB
    {
        public List<FloorAdminModel> TANG(string id)
        {
            List<FloorAdminModel> list = new List<FloorAdminModel>();
            SqlCommand command = CreateCommand("select * from TANG");

            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read())
            {
                FloorAdminModel flo = new FloorAdminModel();

                flo.MATANG = dr["MATANG"].ToString();
                flo.TENTANG = dr["TENTANG"].ToString();
                flo.LIST1 = dr["LIST1"].ToString();
                flo.LIST2 = dr["LIST2"].ToString();
                flo.LIST3 = dr["LIST3"].ToString();
                flo.LIST4 = dr["LIST4"].ToString();
                flo.LIST5 = dr["LIST5"].ToString();
                flo.LIST6 = dr["LIST6"].ToString();
                flo.LIST7 = dr["LIST7"].ToString();
                flo.LIST8 = dr["LIST8"].ToString();
                flo.LIST9 = dr["LIST9"].ToString();
                flo.LIST10 = dr["LIST10"].ToString();
                flo.LIST11 = dr["LIST11"].ToString();
                flo.LISTIMG1 = dr["LISTIMG1"].ToString();
                flo.LISTIMG2 = dr["LISTIMG2"].ToString();
                flo.LISTIMG3 = dr["LISTIMG3"].ToString();
                flo.LISTIMG4 = dr["LISTIMG4"].ToString();
                flo.LISTIMG5 = dr["LISTIMG5"].ToString();
                flo.LISTIMG6 = dr["LISTIMG6"].ToString();
                flo.LISTIMG7 = dr["LISTIMG7"].ToString();
                flo.LISTIMG8 = dr["LISTIMG8"].ToString();
                flo.LISTIMG9 = dr["LISTIMG9"].ToString();
                flo.LISTIMG10 = dr["LISTIMG10"].ToString();
                flo.LISTIMG11 = dr["LISTIMG11"].ToString();
                flo.LISTIMG12 = dr["LISTIMG12"].ToString();
                flo.LISTIMG13 = dr["LISTIMG13"].ToString();
                flo.LISTIMG14 = dr["LISTIMG14"].ToString();
                flo.LISTIMG15 = dr["LISTIMG15"].ToString();
                

                list.Add(flo);
            }
            Connection.Close();
            return list;
        }
        public List<FloorAdminModel> deleteTANG(string id)
        {
            List<FloorAdminModel> list = new List<FloorAdminModel>();
            SqlCommand command = CreateCommand("select * from TANG where MATANG='"+id+"'");

            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read()==true)
            {
                FloorAdminModel flo = new FloorAdminModel();

                flo.MATANG = dr["MATANG"].ToString();
                flo.TENTANG = dr["TENTANG"].ToString();
                flo.LIST1 = dr["LIST1"].ToString();
                flo.LIST2 = dr["LIST2"].ToString();
                flo.LIST3 = dr["LIST3"].ToString();
                flo.LIST4 = dr["LIST4"].ToString();
                flo.LIST5 = dr["LIST5"].ToString();
                flo.LIST6 = dr["LIST6"].ToString();
                flo.LIST7 = dr["LIST7"].ToString();
                flo.LIST8 = dr["LIST8"].ToString();
                flo.LIST9 = dr["LIST9"].ToString();
                flo.LIST10 = dr["LIST10"].ToString();
                flo.LIST11 = dr["LIST11"].ToString();
                flo.LISTIMG1 = dr["LISTIMG1"].ToString();
                flo.LISTIMG2 = dr["LISTIMG2"].ToString();
                flo.LISTIMG3 = dr["LISTIMG3"].ToString();
                flo.LISTIMG4 = dr["LISTIMG4"].ToString();
                flo.LISTIMG5 = dr["LISTIMG5"].ToString();
                flo.LISTIMG6 = dr["LISTIMG6"].ToString();
                flo.LISTIMG7 = dr["LISTIMG7"].ToString();
                flo.LISTIMG8 = dr["LISTIMG8"].ToString();
                flo.LISTIMG9 = dr["LISTIMG9"].ToString();
                flo.LISTIMG10 = dr["LISTIMG10"].ToString();
                flo.LISTIMG11 = dr["LISTIMG11"].ToString();
                flo.LISTIMG12 = dr["LISTIMG12"].ToString();
                flo.LISTIMG13 = dr["LISTIMG13"].ToString();
                flo.LISTIMG14 = dr["LISTIMG14"].ToString();
                flo.LISTIMG15 = dr["LISTIMG15"].ToString();


                list.Add(flo);
            }
            Connection.Close();
            return list;
        }
        public List<FloorAdminModel> editTANG(string id)
        {
            List<FloorAdminModel> list = new List<FloorAdminModel>();
            SqlCommand command = CreateCommand("select * from TANG where MATANG='" + id + "'");

            SqlDataReader dr;
            dr = command.ExecuteReader();
            while (dr.Read() == true)
            {
                FloorAdminModel flo = new FloorAdminModel();

                flo.MATANG = dr["MATANG"].ToString();
                flo.TENTANG = dr["TENTANG"].ToString();
                flo.LIST1 = dr["LIST1"].ToString();
                flo.LIST2 = dr["LIST2"].ToString();
                flo.LIST3 = dr["LIST3"].ToString();
                flo.LIST4 = dr["LIST4"].ToString();
                flo.LIST5 = dr["LIST5"].ToString();
                flo.LIST6 = dr["LIST6"].ToString();
                flo.LIST7 = dr["LIST7"].ToString();
                flo.LIST8 = dr["LIST8"].ToString();
                flo.LIST9 = dr["LIST9"].ToString();
                flo.LIST10 = dr["LIST10"].ToString();
                flo.LIST11 = dr["LIST11"].ToString();
                flo.LISTIMG1 = dr["LISTIMG1"].ToString();
                flo.LISTIMG2 = dr["LISTIMG2"].ToString();
                flo.LISTIMG3 = dr["LISTIMG3"].ToString();
                flo.LISTIMG4 = dr["LISTIMG4"].ToString();
                flo.LISTIMG5 = dr["LISTIMG5"].ToString();
                flo.LISTIMG6 = dr["LISTIMG6"].ToString();
                flo.LISTIMG7 = dr["LISTIMG7"].ToString();
                flo.LISTIMG8 = dr["LISTIMG8"].ToString();
                flo.LISTIMG9 = dr["LISTIMG9"].ToString();
                flo.LISTIMG10 = dr["LISTIMG10"].ToString();
                flo.LISTIMG11 = dr["LISTIMG11"].ToString();
                flo.LISTIMG12 = dr["LISTIMG12"].ToString();
                flo.LISTIMG13 = dr["LISTIMG13"].ToString();
                flo.LISTIMG14 = dr["LISTIMG14"].ToString();
                flo.LISTIMG15 = dr["LISTIMG15"].ToString();


                list.Add(flo);
            }
            Connection.Close();
            return list;
        }
    }
}